const { resolve } = require('path')

const Router = require('koa-router')
const router = new Router()

const { MANAGE_BASEROUTER } = require(resolve(__dirname, '../config/default'))

const { verifyToken } = require(resolve(__dirname, '../middleware/index'))

const {
  addDiscuss,
  getDiscuss,
  getDiscussAll,
  delDiscuss
} = require(resolve(__dirname, '../routerHandle/managementHandle/discuss'))


// 查询评论 /api/manage
router.get(MANAGE_BASEROUTER + '/discuss/find', getDiscuss)

// 查询所有评论 /api/manage
router.get(MANAGE_BASEROUTER + '/discuss/find/all', getDiscussAll)

// 添加评论 /api/manage
router.post(MANAGE_BASEROUTER + '/discuss/add', verifyToken, addDiscuss)

// 删除评论 /api/manage
router.post(MANAGE_BASEROUTER + '/discuss/del', verifyToken, delDiscuss)


module.exports = router